package com.proposition.commons.enums;

import com.baomidou.mybatisplus.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

import java.io.Serializable;

/**
 * 试卷审核状态
 * @author Administrator
 */
public enum CheckStatus implements IEnum {
	WEI_SHEN_HE(0,"未审核"),
	YI_SHEN_PASS(1, "一审通过"),
	ER_SHEN_PASS(2, "二审通过"),
	SAN_SHEN_PASS(3, "三审通过"),
	YI_SHEN_UNPASS(4, "一审未过"),
	ER_SHEN_UNPASS(5, "二审未过"),
	SAN_SHEN_UNPASS(6, "三审未过");
	private int value;
	private String desc;

	CheckStatus(int value, String desc) {
		this.value = value;
		this.desc = desc;
	}

	@Override
	public Serializable getValue() {
		return this.value;
	}

	private void setValue(int value) {
		this.value = value;
	}


	private void setDesc(String desc) {
		this.desc = desc;
	}

	@JsonValue // Jackson 注解，可序列化该属性为中文描述【可无】
	public String getDesc(){
		return this.desc;
	}

	public static CheckStatus stringFormatEnum(String str){
		if(WEI_SHEN_HE.getDesc().equals(str)){
			return CheckStatus.WEI_SHEN_HE;
		}else if(YI_SHEN_PASS.getDesc().equals(str)){
			return CheckStatus.YI_SHEN_PASS;
		}else if(ER_SHEN_PASS.getDesc().equals(str)){
			return CheckStatus.ER_SHEN_PASS;
		}else if(SAN_SHEN_PASS.getDesc().equals(str)){
			return CheckStatus.SAN_SHEN_PASS;
		}else if(YI_SHEN_UNPASS.getDesc().equals(str)){
			return CheckStatus.YI_SHEN_UNPASS;
		}else if(ER_SHEN_UNPASS.getDesc().equals(str)){
			return CheckStatus.ER_SHEN_UNPASS;
		}else if(SAN_SHEN_UNPASS.getDesc().equals(str)){
			return CheckStatus.SAN_SHEN_UNPASS;
		}else{
			return null;
		}
	}
}
